<template>
	<view class="releasePlan-content">
		<!-- <view class="releasePlan-class" @click="goStaminaTest">
			<view class="releasePlan-class_name text_black">组织学生进行体测<image src="../../static/imgs/mine/right.png"></image></view>
			<view class="releasePlan-class_tips text_opblack">您可以在App上组织学生去体测</view>
		</view> -->
		<view class="releasePlan-class" @click="release">
			<view class="releasePlan-class_name text_black">布置训练计划<image src="../../static/imgs/mine/right.png"></image></view>
			<view class="releasePlan-class_tips text_opblack">您可以对您教的班级学生布置训练计划</view>
		</view>
		<view class="releasePlan-class" @click="correctPlan">
			<view class="releasePlan-class_name text_black">批改训练计划<image src="../../static/imgs/mine/right.png"></image></view>
			<view class="releasePlan-class_tips text_opblack">查看并批改训练计划</view>
		</view>
		<view class="releasePlan-class" @click="goPreparation">
			<view class="releasePlan-class_name text_black">教学备课助手<image src="../../static/imgs/mine/right.png"></image></view>
			<view class="releasePlan-class_tips text_opblack">上传并编写您的备课教案内容</view>
		</view>
		<!-- <view class="release-box">
			<view class="text_opblack">您所在的学校已入驻奥北体能平台，您可以发布训练计划</view>
			<view class="button" @click="selectRelease">发布训练计划</view>
		</view>
		<view class="release-box">
			<view class="text_opblack">您所在的学校已入驻奥北体能平台，您可以发布查看体测</view>
			<view class="button" @click="goStudent">查看学生体测</view>
		</view> -->
		<!-- <view class="release-list">
			<newList :list="list" imgField="course_img" titleField="course_title" tipsField="lessson_title"
				timeField="time" @handleClick="detailsClick"></newList>
		</view> -->
	</view>
</template>

<script>
	import {
		getTrainingIndex
	} from "../../static/js/api/training.js"
	import newList from "../../components/new_list/index.vue"
	export default {
		components: {
			newList,
		},
		data() {
			return {
				list: [],
				schooldId:null,
			}
		},
		onLoad(option) {
			if(option.schooldId){
				this.schooldId = option.schooldId
			}
			// this.getData()
		},
		methods: {
			// 让学生去体测
			goStaminaTest(){
				uni.navigateTo({
					url:'/pages/releasePlan/staminaTest/grade?schooldId='+this.schooldId
				})
			},
			// 布置训练计划
			release(){
				uni.navigateTo({
					url:'/pages/releasePlan/release/grade?schooldId='+this.schooldId
				})
			},
			// 教学备案助手
			goPreparation(){
				uni.navigateTo({
					url:"/pages/releasePlan/preparation/index"
				})
			},
			//批改训练计划
			correctPlan(){
				uni.navigateTo({
					url:'/pages/releasePlan/correctPlan/grade?schooldId='+this.schooldId
				})
			},
			
			getData() {
				getTrainingIndex({
					page: 1,
					per_page: 9999
				}).then(res => {
					// console.log(res.trainings)
					if (res.trainings) {
						res.trainings.forEach(item => {
							let times = item.create_time.split(" ")
							item.time = times[0]
						})
						this.list = res.trainings
					}
				})
			},
			selectRelease() {
				uni.navigateTo({
					url: "/pages/releasePlan/chapter"
				})
			},
			goStudent() {
				uni.navigateTo({
					url: "/pages/campus/sportsTesting"
				})
			},
			detailsClick(item) {
				console.log(item)
				uni.navigateTo({
					url: "/pages/releasePlan/planStudent?trainingId=" + item.training_id + '&time=' + item.time
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url("./index.scss");

	.text_opblack {
		color: $uni-text-color-opblack;
	}

	.text_black {
		color: $uni-text-color-black;
	}

	.text_active {
		color: #FF6E00 !important;
	}

	.release-box {
		margin-bottom: 20rpx;
	}

	.release-list {
		background: #ffffff;
	}
</style>